﻿using iS3.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iS3.Server.Core
{
    public interface IRepository<T> where T:DGBase
    {
        bool InitTable( string dataset = null);
        int Count(string dataset = null,WhereOption option=null);

        T Create(T model,string dataset=null);
        List<T> BatchCreate(List<T> models, string dataset = null);

        T Update(T model, string dataset = null);
        T Update(T model, string propertyName, string dataset = null);
        T Update(T model, List<string> propertyNames, string dataset = null);
        List<T> BatchUpdate(List<T> models, string dataset = null);
        T AppendFile(long id, string fileIds,string dataset=null);
        T RemoveFile(long id, string fileIds, string dataset = null);
        T Retrieve(long id, string dataset = null);

        List<T> RetrieveList(string dataset=null, string order = "ID", bool increase = true,WhereOption option=null);
        List<T> RetrieveByPage(int pageSize, int currentPage,string orderProperty,bool increase, string dataset=null, WhereOption option = null);

        int Delete(long id, string dataset = null);
        int BatchDelete(List<long> ids, string dataset = null);
    }
}
